package com.example.demoes.controller;

import com.example.demoes.service.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author: rosszhang
 * @date: 2023/12/9 13:23
 * @description: Es 索引
 **/
@Api(tags = "Es 索引控制器")
@RestController
@RequestMapping("/index")
@RequiredArgsConstructor
public class IndexController {

    private final IndexService indexService;

    @ApiOperation(value = "根据索引名称检查索引是否存在")
    @GetMapping("/exists")
    public Object exists(@RequestParam(name = "indexName") String indexName) throws IOException {
        return this.indexService.existsIndex(indexName);
    }


}
